//
//  LTLfuTableViewController.m
//  WeiBo
//
//  Created by Apple_Lzzy46 on 16/9/14.
//  Copyright © 2016年 LTL. All rights reserved.
//

#import "LTLfuTableViewController.h"
#import "LTLOAuth2.h"

@interface LTLfuTableViewController ()<LTLlandViewDelegat>


@end
/**
 *  是否已登录
 */

@implementation LTLfuTableViewController
///层次结构
-(void)loadView
{
    BOOL lande         = [LTLModel read].access_token;
    ///三目运算符
    ///判断是否已登录来切换视图
    lande ?  [super loadView]:[self landView];

}
- (void)viewDidLoad {
    [super viewDidLoad];
}
///登录视图
-(void)landView
{
    self.langView                          = [[LTLlandView alloc]init];
        //遵守代理
    self.langView.deleget                  = self;

        ///替换视图
    self.view                              = _langView;
        ///设置导航按钮
    self.navigationItem.leftBarButtonItem  = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStyleDone target:self action:@selector(login)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStyleDone target:self action:nil];
}
//视图即将显示
//-(void)viewWillAppear:(BOOL)animated
//{
//    
//}
//实现代理方法
/**
 *  登录
 */
-(void)login
{
    /**
     登录界面
     */
    LTLOAuth2 *OAuth                       = [[LTLOAuth2 alloc]init];
    UINavigationController *na             = [[UINavigationController alloc]initWithRootViewController:OAuth];

    [self.navigationController presentViewController:na animated:YES completion:nil];
}
/**
 *  注册
 */
-(void)regisereg
{
    NSLog(@"jkknf12");
}
@end
